package com.zc.imooc.finaltest.kafka.adminClient.service;

import com.zc.imooc.finaltest.kafka.adminClient.KafkaAdminClient;
import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.NewTopic;
import org.springframework.stereotype.Service;

import java.util.Arrays;

/**
 * @program: final-test
 * @description: AdminClientService
 * @author: zengchen
 * @create: 2020-09-21 09:30
 **/
@Service
public class AdminClientService {

    public void createTopic(NewTopic newTopic) {
        AdminClient adminClient = KafkaAdminClient.getAdminClient();
        adminClient.createTopics(Arrays.asList(newTopic));
    }
}
